/**
  @file     	DESIGNPATTERN_Director.h 
  @brief    	1.When the algorithm to create complex object should be independent of the part of the object, 
                  as well as their assembly;
				2.When construction process must be allowed to construct the object is different;
  @author  	arvin
  @version 	1.0   2012/12/20
 */
#include "stdafx.h"

#ifndef CXX_DESIGNPATTERN_DIRECTOR_H
#include "DESIGNPATTERN_Director.h"
#endif

#ifndef CXX_DESIGNPATTERN_BUILDER_H
#include "DESIGNPATTERN_Builder.h"
#endif

#ifndef CXX_DESIGNPATTERN_ABSTRACTFACTORY_H
#include "DESIGNPATTERN_AbstractFactory.h"
#endif

#ifndef CXX_COMPUTER_H
#include "Computer.h"
#endif

 /**
 * Construction
 *
 * @param VOID
 * @return
 */
Director::Director(COMPUTER_TYPE eComputer) :
	m_eComputer(eComputer)
{
	DEBUG_PRINTF("m_eComputer[%d], Computer[%s]", m_eComputer, STATIC_CONST_STRING_COMPUTER[m_eComputer].c_str());
}

/**
* Destruction
*
* @param VOID
* @return
*/
Director::~Director()
{
	DEBUG_PRINTF("m_eComputer[%d], Computer[%s]", m_eComputer, STATIC_CONST_STRING_COMPUTER[m_eComputer].c_str());
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
Director::CreateAbstractComputer()
{
	DEBUG_PRINTF("m_eComputer[%d], Computer[%s]", m_eComputer, STATIC_CONST_STRING_COMPUTER[m_eComputer].c_str());
	return NULL;
}

/**
* SetComputer
*
* @param COMPUTER_TYPE eComputer
* @return
*/
VOID
Director::SetComputer(COMPUTER_TYPE eComputer)
{
	DEBUG_PRINTF("m_eComputer[%d], Computer[%s]", m_eComputer, STATIC_CONST_STRING_COMPUTER[m_eComputer].c_str());
	m_eComputer = eComputer;
}

/**
* GetComputer
*
* @param VOID
* @return COMPUTER_TYPE
*/
COMPUTER_TYPE
Director::GetComputer()
{
	DEBUG_PRINTF("m_eComputer[%d], Computer[%s]", m_eComputer, STATIC_CONST_STRING_COMPUTER[m_eComputer].c_str());
	return m_eComputer;
}

/**
* Construction
*
* @param VOID
* @return
*/
NotebookDirector::NotebookDirector(COMPUTERPART_TYPE eComputerPart) :
	Director(COMPUTER_NOTEBOOK),
	m_eComputerPart(eComputerPart)
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
}

/**
* Destruction
*
* @param VOID
* @return
*/
NotebookDirector::~NotebookDirector()
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
NotebookDirector::CreateAbstractComputer()
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
	return NULL;
}

/**
* SetComputerPart
*
* @param COMPUTERPART_TYPE eComputerPart
* @return
*/
VOID
NotebookDirector::SetComputerPart(COMPUTERPART_TYPE eComputerPart)
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
	m_eComputerPart = eComputerPart;
}

/**
* GetComputerPart
*
* @param VOID
* @return COMPUTERPART_TYPE
*/
COMPUTERPART_TYPE
NotebookDirector::GetComputerPart()
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
	return m_eComputerPart;
}

/**
* Construction
*
* @param VOID
* @return
*/
DesktopDirector::DesktopDirector(COMPUTERPART_TYPE eComputerPart) :
	Director(COMPUTER_DESKTOP),
	m_eComputerPart(eComputerPart)
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
}

/**
* Destruction
*
* @param VOID
* @return
*/
DesktopDirector::~DesktopDirector()
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
DesktopDirector::CreateAbstractComputer()
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
	return NULL;
}

/**
* SetComputerPart
*
* @param COMPUTERPART_TYPE eComputerPart
* @return
*/
VOID
DesktopDirector::SetComputerPart(COMPUTERPART_TYPE eComputerPart)
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
	m_eComputerPart = eComputerPart;
}

/**
* GetComputerPart
*
* @param VOID
* @return COMPUTERPART_TYPE
*/
COMPUTERPART_TYPE
DesktopDirector::GetComputerPart()
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
	return m_eComputerPart;
}

/**
* Construction
*
* @param VOID
* @return
*/
ServerDirector::ServerDirector(COMPUTERPART_TYPE eComputerPart) :
	Director(COMPUTER_SERVER),
	m_eComputerPart(eComputerPart)
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
}

/**
* Destruction
*
* @param VOID
* @return
*/
ServerDirector::~ServerDirector()
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
ServerDirector::CreateAbstractComputer()
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
	return NULL;
}

/**
* SetComputerPart
*
* @param COMPUTERPART_TYPE eComputerPart
* @return
*/
VOID
ServerDirector::SetComputerPart(COMPUTERPART_TYPE eComputerPart)
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
	m_eComputerPart = eComputerPart;
}

/**
* GetComputerPart
*
* @param VOID
* @return COMPUTERPART_TYPE
*/
COMPUTERPART_TYPE
ServerDirector::GetComputerPart()
{
	DEBUG_PRINTF("m_eComputerPart[%d], ComputerPart[%s]", m_eComputerPart, STATIC_CONST_STRING_COMPUTERPART[m_eComputerPart].c_str());
	return m_eComputerPart;
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
NotebookDirectorNormal::NotebookDirectorNormal(Builder* pBuilder) :
	NotebookDirector(COMPUTERPART_NORMAL),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
NotebookDirectorNormal::~NotebookDirectorNormal()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
NotebookDirectorNormal::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerNormal(m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
NotebookDirectorDoubleMouse::NotebookDirectorDoubleMouse(Builder* pBuilder) :
	NotebookDirector(COMPUTERPART_DOUBLEMOUSE),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
NotebookDirectorDoubleMouse::~NotebookDirectorDoubleMouse()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
NotebookDirectorDoubleMouse::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerDoubleMouse(m_pBuilder->BuildMouse(), m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
NotebookDirectorDoubleKeyboard::NotebookDirectorDoubleKeyboard(Builder* pBuilder) :
	NotebookDirector(COMPUTERPART_DOUBLEKEYBOARD),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
NotebookDirectorDoubleKeyboard::~NotebookDirectorDoubleKeyboard()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
NotebookDirectorDoubleKeyboard::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerDoubleKeyboard(m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
NotebookDirectorDoubleMonitor::NotebookDirectorDoubleMonitor(Builder* pBuilder) :
	NotebookDirector(COMPUTERPART_DOUBLEMONITOR),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
NotebookDirectorDoubleMonitor::~NotebookDirectorDoubleMonitor()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
NotebookDirectorDoubleMonitor::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerDoubleMonitor(m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
DesktopDirectorNormal::DesktopDirectorNormal(Builder* pBuilder) :
	DesktopDirector(COMPUTERPART_NORMAL),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
DesktopDirectorNormal::~DesktopDirectorNormal()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
DesktopDirectorNormal::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerNormal(m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
DesktopDirectorDoubleMouse::DesktopDirectorDoubleMouse(Builder* pBuilder) :
	DesktopDirector(COMPUTERPART_DOUBLEMOUSE),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
DesktopDirectorDoubleMouse::~DesktopDirectorDoubleMouse()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
DesktopDirectorDoubleMouse::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerDoubleMouse(m_pBuilder->BuildMouse(), m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
DesktopDirectorDoubleKeyboard::DesktopDirectorDoubleKeyboard(Builder* pBuilder) :
	DesktopDirector(COMPUTERPART_DOUBLEKEYBOARD),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
DesktopDirectorDoubleKeyboard::~DesktopDirectorDoubleKeyboard()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
DesktopDirectorDoubleKeyboard::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerDoubleKeyboard(m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
DesktopDirectorDoubleMonitor::DesktopDirectorDoubleMonitor(Builder* pBuilder) :
	DesktopDirector(COMPUTERPART_DOUBLEMONITOR),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
DesktopDirectorDoubleMonitor::~DesktopDirectorDoubleMonitor()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
DesktopDirectorDoubleMonitor::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerDoubleMonitor(m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
ServerDirectorNormal::ServerDirectorNormal(Builder* pBuilder) :
	ServerDirector(COMPUTERPART_NORMAL),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
ServerDirectorNormal::~ServerDirectorNormal()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
ServerDirectorNormal::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerNormal(m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
ServerDirectorDoubleMouse::ServerDirectorDoubleMouse(Builder* pBuilder) :
	ServerDirector(COMPUTERPART_DOUBLEMOUSE),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
ServerDirectorDoubleMouse::~ServerDirectorDoubleMouse()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
ServerDirectorDoubleMouse::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerDoubleMouse(m_pBuilder->BuildMouse(), m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
ServerDirectorDoubleKeyboard::ServerDirectorDoubleKeyboard(Builder* pBuilder) :
	ServerDirector(COMPUTERPART_DOUBLEKEYBOARD),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
ServerDirectorDoubleKeyboard::~ServerDirectorDoubleKeyboard()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
ServerDirectorDoubleKeyboard::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerDoubleKeyboard(m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}

/**
* Construction
*
* @param Builder* pBuilder
* @return
*/
ServerDirectorDoubleMonitor::ServerDirectorDoubleMonitor(Builder* pBuilder) :
	ServerDirector(COMPUTERPART_DOUBLEMONITOR),
	m_pBuilder(pBuilder)
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return
*/
ServerDirectorDoubleMonitor::~ServerDirectorDoubleMonitor()
{
	DEBUG_PRINTF("");
	m_pBuilder = NULL; //not need to delete the builder, because of the build is singleton
}

/**
* Create Computer
*
* @param VOID
* @return AbstractComputer*
* @note
*/
AbstractComputer*
ServerDirectorDoubleMonitor::CreateAbstractComputer()
{
	if (NULL == m_pBuilder) {
		return NULL;
	}

	return new DesktopComputerDoubleMonitor(m_pBuilder->BuildMouse(), m_pBuilder->BuildKeyboard(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildMonitor(), m_pBuilder->BuildHost());
}
/* EOF */